Public Class WhenParameterAttribute
    Inherits ActionMethodSelectorAttribute

    Private _name As String
    Public Property Name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property

    Private _value As String
    Public Property Value() As String
        Get
            Return _value
        End Get
        Set(ByVal value As String)
            _value = value
        End Set
    End Property

    Public Overrides Function IsValidForRequest(ByVal controllerContext As System.Web.Mvc.ControllerContext, ByVal methodInfo As System.Reflection.MethodInfo) As Boolean
        Dim value = controllerContext.HttpContext.Request(_name)
        Return Not String.IsNullOrEmpty(value) AndAlso value.Equals(_value, StringComparison.OrdinalIgnoreCase)
    End Function
End Class